<#import "./shared_macros.ftl" as shared>
<#import "root://activities/common/kotlin_macros.ftl" as kt>

<#if isInstantApp>
apply plugin: 'com.android.feature'
<#else>
  <#if isLibraryProject>
apply plugin: 'com.android.library'
  <#elseif isDynamicFeature>
apply plugin: 'com.andorid.dynamic-feature'
  <#else>
apply from: 'deploy.gradle'
apply plugin: 'com.android.application'
  </#if>
</#if>
<#if generateKotlin>
<#compress>
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
</#compress>
</#if>

<#if generateKotlin>
kapt {
    arguments {
        arg("AROUTER_MODULE_NAME", project.getName())
    }
}

androidExtensions {
    experimental = true
}
</#if>

<@shared.androidConfig hasApplicationId=isApplicationProject applicationId=packageName isBaseFeature=isBaseFeature hasTests=true canHaveCpp=true canUseProguard=isApplicationProject||isBaseFeature||(isLibraryProject&&!isInstantApp)/>

dependencies {
    ${getConfigurationName("compile")} fileTree(dir: 'libs', include: ['*.jar'])

    <#if isApplicationProject>
    //common-base
    ${getConfigurationName("compile")} rootProject.ext.deps.fastLib.common_base
    //pull to refresh
    ${getConfigurationName("compile")} rootProject.ext.deps.fastLib.pull_to_refresh
    //smart rv adapter
    ${getConfigurationName("compile")} rootProject.ext.deps.fastLib.smart_rv_adapter
    //bottom-bar
    ${getConfigurationName("compile")} rootProject.ext.deps.fastLib.bottombar
    //viewpager_indicator
    ${getConfigurationName("compile")} rootProject.ext.deps.fastLib.viewpager_indicator

    <#if generateKotlin>
    ${getConfigurationName("compile")} rootProject.ext.deps.kotlin.stdlib
    //ARouter
    kapt rootProject.ext.deps.aRouter.compiler
    <#else>
    //Arouter
    annotationProcessor rootProject.ext.deps.aRouter.compiler
    //butterKnife
    ${getConfigurationName("compile")} rootProject.ext.deps.butterknife.runtime
    annotationProcessor rootProject.ext.deps.butterknife.compiler
    </#if>
    </#if>

    <#if !improvedTestDeps>
    ${getConfigurationName("androidTestCompile")}('com.android.support.test.espresso:espresso-core:${espressoVersion!"+"}', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    </#if>

<#if isInstantApp||isDynamicFeature>
  <#if isBaseFeature>
    <#if monolithicModuleName?has_content>
    application project(':${monolithicModuleName}')
    <#else>
    // TODO: Add dependency to the main application.
    // application project(':app')
    </#if>
  <#else>
    implementation project(':${baseFeatureName}')
  </#if>
</#if>

}
